// import './assets/main.css'

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css' // 新增：引入暗黑主题
import VCalendar from 'v-calendar'
import 'v-calendar/style.css'
// 替换为兼容Vue 3的nprogress
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import './assets/style/globla.css'
// 导入权限指令
import permissionDirective from './directives/permissions'

const app = createApp(App)

// 配置NProgress
NProgress.configure({
  showSpinner: false,
  trickleSpeed: 100
})

// 在路由守卫中使用NProgress
router.beforeEach((to, from, next) => {
  NProgress.start()
  next()
})

router.afterEach(() => {
  NProgress.done()
})

app.use(router)
app.use(ElementPlus)
app.use(VCalendar, {})

// 注册权限指令
app.directive('permission', permissionDirective)

app.mount('#app')
